package physics;

import java.awt.Shape;

public class MovableObstacle extends Obstacle{

	public MovableObstacle(Coordinate location, Shape bound, double mass,Vector vector) {
		super(location, bound, mass);
		setVector(vector);
	}
	
	/**
	 * adds the power of the vector once and updates the position of the obstacle 
	 */
	public void updatePosition(){
		this.setLocation(getLocation().addVector(getVector(), (1 / (double) (World.ACTION_RATE))));
	}

	/**
	 * acts
	 */
	@Override
	public void act(){
		if(getWorld() != null){
			for (Vector v : getWorld().getActingVectors(this.getLocation()))
				this.getVector().addVector(v);
					updatePosition();
		}
	}
	
	
	
	
}
